package com.hdy.web.pojo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProfitData {
   /*日期	*/
   @ExcelProperty(value = "日期",index = 0)
   @ColumnWidth(11)
   String Date;
    /*订单编号*/
    @ExcelProperty(value = "订单编号",index = 1)
    @ColumnWidth(20)
    String OrderNo;
    /*成交金额*/
    @ExcelProperty(value = "成交金额",index = 2)
    @ColumnWidth(11)
    BigDecimal TransactionAmount;
    /*成本*/
    @ExcelProperty(value = "成本",index = 3)
    @ColumnWidth(7)
    BigDecimal Cost;
    /*平台服务费*/
    @ExcelProperty(value = "平台服务费",index = 4)
    @ColumnWidth(14)
    BigDecimal Charge;
    /*运费险*/
    @ExcelProperty(value = "运费险",index = 5)
    @ColumnWidth(9)
    Integer Insurance=3;
    /*返佣*/
    /*达人佣金*/
    @ExcelProperty(value = "达人佣金",index = 6)
    @ColumnWidth(11)
    BigDecimal Commission;
    /*售后预估费用*/
    @ExcelProperty(value = "售后预估费用",index = 7)
    @ColumnWidth(17)
    Integer EstimatedCost;
    /*利润*/
    @ExcelProperty(value = "毛利",index = 8)
    @ColumnWidth(8)
    BigDecimal profit;
    /*返佣*/
   @ExcelProperty(value = "返佣",index =9)
   @ColumnWidth(8)
    BigDecimal return_Commission;
   /*总利润*/
   @ExcelProperty(value = "最终利润",index =10)
   @ColumnWidth(11)
    BigDecimal totalProfit;
    public void setDate(String date){
     this.Date=date.substring(0,date.indexOf(" "));
    }
 public void calculateProfit() {
  BigDecimal insurance = BigDecimal.valueOf(Insurance);
  BigDecimal estimateCost = BigDecimal.valueOf(EstimatedCost);
  this.setProfit(this.TransactionAmount.subtract(this.getCost()).subtract(insurance).subtract(estimateCost).subtract(this.getCharge()).subtract(this.getCommission()));
 }
}
